package com.creative.accountsdk.net.account;

import com.creative.accountsdk.DataCenter;
import com.creative.accountsdk.UmsChannel;
import com.creative.accountsdk.UserData;
import com.creative.accountsdk.net.Protocol;
import com.creative.accountsdk.net.XParams;
import com.loopj.android.http.RequestParams;
import org.json.JSONObject;

/**
 * 选择身份
 * Created by David on 2015/11/25.
 */
public class TeacherInviteProtocol extends Protocol {
    private int  currentRole;   //当前角色
    private String    tiCode;   //邀请码
    private String    name ;    //真实姓名
    private UserData  userData;
    public JSONObject jsonUser;

    public TeacherInviteProtocol(int currentRole,String tiCode,
                                 String  name) {
        this.currentRole = currentRole;
        this.userData = UserData.getInstance();
        this.tiCode = tiCode;
        this.name = name;
    }

    @Override
    public RequestParams getParams() {
        return new XParams()
                .put("uid", userData.getUid())
                .put("token", userData.getToken())
                .put("role",currentRole)
                .put("ticode",tiCode)
                .put("name",name)
                .put(UmsChannel.PARAM_NAME, UmsChannel.getChannel())
                .getParams();
    }

    @Override
    public String getUrl() {
        return getUrlPrefix()+"ui/role";
    }

    @Override
    protected void parseReturnMap(JSONObject returnMap) {
        jsonUser = returnMap;
    }
}
